CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(chapter1)

CreateLibrary()

FILE(GLOB RUNNERSOURCES "${CMAKE_CURRENT_SOURCE_DIR}/runners/*.cpp")

FOREACH(RUNNERSOURCE ${RUNNERSOURCES})

	CreateExecutable(${RUNNERSOURCE} chapter1 TKernel TKMath)

ENDFOREACH(RUNNERSOURCE)

ADD_CUSTOM_COMMAND(TARGET chapter1_2
		   POST_BUILD
		   COMMAND ${CMAKE_COMMAND} -E copy_directory
		   "${CMAKE_CURRENT_SOURCE_DIR}/python"
		   "${CMAKE_BINARY_DIR}/bin")

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/testrunners")
FILE(GLOB TESTSOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/*.cpp")
ADD_EXECUTABLE(chapter1_test ${TESTSOURCES})
TARGET_LINK_LIBRARIES(chapter1_test chapter1 TKernel TKMath)
ADD_TEST(chapter1_tests "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/chapter1_test")
